package com.viu.technology.controller;

import com.viu.technology.dto.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
import reactor.core.publisher.Flux;

@RestController
@RequestMapping("/api")
public class APIController {

    @Autowired
    public RestTemplate restTemplate;

    @GetMapping(value = "/weatherApi")
    public Result weatherApi(String city) {
        String response=restTemplate.getForObject("https://www.apiopen.top/weatherApi?city={city}", String.class, city);

        return Result.success(response);
    }
}
